package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.PO.cmf_GamePO;
import com.ruoyi.system.domain.dto.MatchDTO;
import com.ruoyi.system.mapper.MatchMapper;
import com.ruoyi.system.service.MatchService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.Instant;

/**
 * @author Ly lilongfei
 * @date 2024/9/26
 * @Description
 */
@Service
public class MatchServiceImpl implements MatchService {

    @Resource
    private MatchMapper matchmapper;

    @Override
    public void createNewMatch(MatchDTO matchDTO) {
        Long timemills = System.currentTimeMillis() / 1000;
        cmf_GamePO cmfGamePO = cmf_GamePO.builder()
                .gameName(matchDTO.getMatchName())
                .projectType(matchDTO.getProjectType())
                .type(matchDTO.getType())
                .level(matchDTO.getLevel())
                .startTime(matchDTO.getStartTime())
                .endTime(matchDTO.getEndTime())
                .isImportant(matchDTO.getIsImportant())
                .isSelfHold(matchDTO.getIsSelfHold())
                .isRefer(matchDTO.getIsRefer())
                .createTime(timemills)
                .updateTime(timemills)
                .build();
        Integer res = matchmapper.createNewMatch(cmfGamePO);
    }
}
